<template>
	<view class="">
		<view class="u-f-ajc u-f-c find-header">
			<image class="find-header-img" src="https://statics.xmcsrv.net/weixin/smile.png" mode=""></image>
			<view class="find-header-hint">成功的发现到您周边的设备，点击设备开启添加流程!</view>
		</view>
		<!-- <view class="equipment-title">蓝牙搜索的设备</view> -->
		<j-cell-group title="蓝牙搜索的设备">
			<j-cell data-code="601112" data-eventName="click_blue_dev_dev_list" v-for="(item,index) in list" :key="index" @tap="onBindtapequipment(item)" class="find-cell" custom-prefix="false" :size="40" :icon="item.deviceInfo.devicePic" :title="item.showName" tips="蓝牙配网">
			</j-cell>
		</j-cell-group>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list:[]
			}
		},
		onLoad(opt) {
			this.list = JSON.parse(opt.deviceList)
			this.list.forEach((item)=>{
				let name = item.deviceInfo.deviceTypeName
				let deviceList = []
				if(item.deviceId.includes(':')){
					deviceList = item.deviceId.split(':')
					name = `${name}${deviceList[deviceList.length-2]}${deviceList[deviceList.length-1]}`
				}
				this.$set(item,'showName',name)
			})
			console.log('list',this.list);
		},
		methods: {
			onBindtapequipment(item) {
				console.log('跳转设备');
				uni.navigateTo({
					url: '/jvss/pagesDevice/device/bluetooth/equipment-list?device='+JSON.stringify(item)
				})
			}
		}
	}
</script>

<style lang="scss">
	.find-header {
		margin-bottom: 50rpx;
	}

	.find-header-img {
		width: 100px;
		height: 100px;
		margin: auto;
		margin-top: 60px;
		margin-bottom: 30px;
	}

	.find-header-hint {
		text-align: center;
		padding: 0 150rpx;
		font-size: 28rpx;
	}

	.equipment-title {
		font-size: 24rpx;
		margin-left:30rpx;
		margin-bottom: 20rpx;
		color: #666;
	}

	.find-cell .cell {
		width: 96%;
		margin: auto;
		border-radius: 10rpx;
	}
</style>
